/**
 * 
 */
package info.niwota.ziplock;

import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;

/**
 * @author qiangli
 *
 */
public class PickActivity extends BaseActivity {

	private static final String TAG = "PickActivity";


	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (Debug.DEBUG) {
			Log.d(TAG, "onKeyDown " + keyCode + " event: " + event);
		}
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			doCancel();
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		super.onPrepareOptionsMenu(menu);
		//
		miQuit.setTitle(R.string.action_cancel);
		return true;
	}

	@Override
	protected void doQuit() {
		if (Debug.DEBUG) {
			Log.d(TAG, "doQuit");
		}
		doCancel();
	}

	private void doCancel() {
		//
		setResult(RESULT_CANCELED);
		finish();
	}
}
